UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ug+bcxwjZ+YsetOR1v3YQxRrTr4NFeHqIWdL2HbagZg=' 
WHERE 
  key_id = '4803b3db47632b04d94d3b30e73710c4adc4ae9f814d99c069999f47d333b580' 
  AND (
    token = 'Ug+bcxwjZ+YsetOR1v3YQxRrTr4NFeHqIWdL2HbagZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035