UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H82n1Z6ffP9HdHbOLZk67qnYoRAOqjY/g7vaTNtFQ6w=' 
WHERE 
  key_id = '26e15d86d667d2eadc06cbde240451e16c6c67c5e53b96b36160af7a45a30a93' 
  AND (
    token = 'H82n1Z6ffP9HdHbOLZk67qnYoRAOqjY/g7vaTNtFQ6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043