UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XlqOyMXTTj+nkJD5kRct7ihnMJQOVw0jsMl9QSAkfDo=' 
WHERE 
  key_id = '19c0f67802fa1f74796f1e652ebb413f296b0ea90e493786ecc61b34f923716e' 
  AND (
    token = 'XlqOyMXTTj+nkJD5kRct7ihnMJQOVw0jsMl9QSAkfDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033