UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ASgALK2oP+c3l2e4GJEpm9UjtMBpblh5vt46Cxq31+M=' 
WHERE 
  key_id = '1a0f38b7755eabdbcaf45219c8c6971008011eccd97eba0d5673962392092a2f' 
  AND (
    token = 'ASgALK2oP+c3l2e4GJEpm9UjtMBpblh5vt46Cxq31+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043