UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mAO++Hv1SbuP+8U+fkPcghbDFnqyZS0+ul9N467VD7c=' 
WHERE 
  key_id = '665be8d4cfb52cae7b17c56d6f8e79cb5db2b25ff77abb522e5ade252306e209' 
  AND (
    token = 'mAO++Hv1SbuP+8U+fkPcghbDFnqyZS0+ul9N467VD7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041