UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rH+XJecd2sPp3gOrSvICtXos+1ZilThHIKoaEccQaC0=' 
WHERE 
  key_id = '247485389d5dbe00fc51f8f9d1e7fafff9600c4b84b57c48dac037332434e0f0' 
  AND (
    token = 'rH+XJecd2sPp3gOrSvICtXos+1ZilThHIKoaEccQaC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031