UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gu3eU7A+PJWDbwyhWoo4TFQ4AGaZnaXeqXXx5NO//hE=' 
WHERE 
  key_id = '8b3d8ad2734682f2e6144c718e869c14ab38615cd82842d16adf7f96e6d90f63' 
  AND (
    token = 'Gu3eU7A+PJWDbwyhWoo4TFQ4AGaZnaXeqXXx5NO//hE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025