UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/lxI5dt5r7q3ki+6Ov+DWvYGBf0O79ZIvPlcwbp+GcY=' 
WHERE 
  key_id = '9c4d3d326db3c84d1e764192a871333180869d17a3963661a686c5d8d97161b1' 
  AND (
    token = '/lxI5dt5r7q3ki+6Ov+DWvYGBf0O79ZIvPlcwbp+GcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041