UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lcJnbQoTz9FtVEPtY38/jFe0k+IM5KFvEYkgheDcBXg=' 
WHERE 
  key_id = '02e52e1ea48533ac1a5947de8069d2cda6c7af5f4936b645813606463ee3ac85' 
  AND (
    token = 'lcJnbQoTz9FtVEPtY38/jFe0k+IM5KFvEYkgheDcBXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019