UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GenAt85GrSZ4xHM6XbCl/qxhs0RI3DHjHJAJbPwqXLo=' 
WHERE 
  key_id = '816471f2e4437551e7578a8f3019e4dc6382dd42bbbbc2e10dfec6550b50919b' 
  AND (
    token = 'GenAt85GrSZ4xHM6XbCl/qxhs0RI3DHjHJAJbPwqXLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041