UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O/Fc1CcFbeo2wiaSVOK38jFNjISC7a5dq94/NJz7nVw=' 
WHERE 
  key_id = '1787d9e8cdb09bb13bd410e7e31c98b739c0594a09a5c3974bedac213f0f601d' 
  AND (
    token = 'O/Fc1CcFbeo2wiaSVOK38jFNjISC7a5dq94/NJz7nVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045