UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bP4CcphniK1jHO+pZnjHmjMHulrqzNvO+KoAeEOCfQY=' 
WHERE 
  key_id = '68587e7b958651d30e65d79d937e8070447dce94fa9fe8a8253db88979a1e209' 
  AND (
    token = 'bP4CcphniK1jHO+pZnjHmjMHulrqzNvO+KoAeEOCfQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026