UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zUxYN4pdsei1Ub69KgDHtzcRGNCJG1uFZ2ma2RCWI7Y=' 
WHERE 
  key_id = '380a49d119de2d32592418f68e3d8c27da2d32acc70bf77a616a238b294ec327' 
  AND (
    token = 'zUxYN4pdsei1Ub69KgDHtzcRGNCJG1uFZ2ma2RCWI7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026