UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k5xrfpE+m85o6wSaspY8Yd8epFU8i0LDECtwi5JQNBI=' 
WHERE 
  key_id = '9d6b7bc9b74e196451486ab81f06f2f29b5d74b5d6182845251c18fa7788c6d4' 
  AND (
    token = 'k5xrfpE+m85o6wSaspY8Yd8epFU8i0LDECtwi5JQNBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051