UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AF58Z8IdkwBlaX/wyvXCIyTNzRi02oxY+MF2gFW4EdE=' 
WHERE 
  key_id = '0a2516a00a9bcda346c877f3cee33d8804a443445f7125e89ed2a0b76129ada1' 
  AND (
    token = 'AF58Z8IdkwBlaX/wyvXCIyTNzRi02oxY+MF2gFW4EdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035