UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4ABvGXHbI+cH7FS0f+cw3DztqRYbxBlQBBEGuPAo2qc=' 
WHERE 
  key_id = '290314e71b222bf4e86c1c188d581fc2274cc3f3bbd3ae88beb50f0c598f7068' 
  AND (
    token = '4ABvGXHbI+cH7FS0f+cw3DztqRYbxBlQBBEGuPAo2qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038