UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P9XkA4mWWWwp4odGuIVhN3FjV68ipBN6+qQoSd5x6Tk=' 
WHERE 
  key_id = 'd22856d9a95ae0b72c2d5c4a8c346b084d475620832b905f938d5e77deb51fba' 
  AND (
    token = 'P9XkA4mWWWwp4odGuIVhN3FjV68ipBN6+qQoSd5x6Tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024