UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QKnk+ydtqghAqVT4QDBW3s4XSbI5u3WmjnAOuBDs+/I=' 
WHERE 
  key_id = '6d5a71f3f3be168511c8fc6384cf60e33b4c61e57f276b6f8caa324fe23ac329' 
  AND (
    token = 'QKnk+ydtqghAqVT4QDBW3s4XSbI5u3WmjnAOuBDs+/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030