UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qBbuL8ePs/2wx09iMJeTsvErOQ7K8q9AJrLi/BP6Qlw=' 
WHERE 
  key_id = 'a1ceb9f1d30006c572e48230b6186fa7d2525385c238242cdaefc547e5d91e77' 
  AND (
    token = 'qBbuL8ePs/2wx09iMJeTsvErOQ7K8q9AJrLi/BP6Qlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017