UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2tdu/y21mQ8QLFR+i/eP+HNH2AMrsOZ25GyoX+/QpcU=' 
WHERE 
  key_id = '0871aca50c920055c2c94a3555910681b497af986b4b5c440cec93f6e4d2035d' 
  AND (
    token = '2tdu/y21mQ8QLFR+i/eP+HNH2AMrsOZ25GyoX+/QpcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034