UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H2FVUebwyhxUe02mdVYXvFaeRGxaoGAaDT4Qp13T1O8=' 
WHERE 
  key_id = '3cadf97f0c407f6bbfb056db6de9f0a1759587bc0e3faf848828116c90f72597' 
  AND (
    token = 'H2FVUebwyhxUe02mdVYXvFaeRGxaoGAaDT4Qp13T1O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021