UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XeOkCcyzXrPfxsC8vBjB1ChjqiY1kC3MHzp/j1zALgo=' 
WHERE 
  key_id = 'a8d887a306f3250ae354d5ee45ca98d1270011ca346f4de41bf51e424afc56c6' 
  AND (
    token = 'XeOkCcyzXrPfxsC8vBjB1ChjqiY1kC3MHzp/j1zALgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034