UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uHxWprH/1Ltc+iue+vvOjk/zZ4etgKxba1WLZfP1+9U=' 
WHERE 
  key_id = '876559399ebf32deb03bb349650ebbdc677c708db2a5ac8b62395a6278ff4b04' 
  AND (
    token = 'uHxWprH/1Ltc+iue+vvOjk/zZ4etgKxba1WLZfP1+9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034