UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jG+rDKm6Xak2TEgTEXTZ8N7cFxhRb2P+Doqe4jwu1Sg=' 
WHERE 
  key_id = 'e4d0acc35aefbf18cda4988937b19180fd3c86f0054bec1d27c451002632f0f7' 
  AND (
    token = 'jG+rDKm6Xak2TEgTEXTZ8N7cFxhRb2P+Doqe4jwu1Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026